package Io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
/**
 * 对象流
 * java.io.ObjectOutputStream和ObjectInputStream
 * 对象流是一对高级流,作用是进行对象序列化与反序列化
 * 对象序列化:将一个java对象按照其结构和内容转换为一组字节的过程.反之为对象反序列化.
 */
public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String name = "六哥";
        int age = 11;
        String gender = "男";
        String[] otherInfo ={"技术好","牛逼","克拉苏"};
        Person person = new Person(name,age,gender,otherInfo);
        FileOutputStream fos = new FileOutputStream("Person.obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(person);
        System.out.println("写入完毕");
        oos.close();

    }
}
